import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.IOException;
public class FileWrite {
  public static void main(String[] args)  throws IOException {
   FileOutputStream outstream 
                         = new FileOutputStream("Example.txt");
   PrintWriter pwriter = new PrintWriter(outstream);
   pwriter.println("Riyadh");
   pwriter.println("Abha");
   pwriter.println(22.85);
   pwriter.println('A');
   pwriter.printf("Square root of 16.567 is %.2f%n", Math.sqrt(16.567)); 
   pwriter.print(true);
   pwriter.close();
   // For convenience, let the user know that the file has been created
   System.out.println("The file has Example.txt been created.");   
 }
}